package handler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.ResultSetHandler;

import drh.bean.Order;
import drh.bean.Product;

public class ProductResultSetHandler implements ResultSetHandler<List<Product>> {

	@Override
	public List<Product> handle(ResultSet rs) throws SQLException {
		List<Product>list = new ArrayList<>();
		while(rs.next()) {
			Product info = new Product();
			info.setId(rs.getInt("id"));
			info.setProductid(rs.getInt("productid"));
			info.setClassification(rs.getInt("classification"));
			info.setOriginalprice(rs.getInt("originalprice"));
			info.setPresentprice(rs.getInt("Presentprice"));
			info.setCount(rs.getInt("count"));
			info.setContent(rs.getString("content"));
			info.setImgid(rs.getInt("imgid"));
			info.setIntegral(rs.getInt("integral"));
			info.setTime(rs.getString("time"));
			info.setIsdelete(rs.getInt("isdelete"));
			list.add(info);
		}
		return list;
	}	
}
